package com.sky.mapper;

import com.sky.dto.ShoppingCartDTO;
import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
    ShoppingCart select(ShoppingCartDTO shoppingCartDTO);
@Update("update shopping_cart set number=#{number} where id=#{id}")
    void update(ShoppingCart cart);

    void insert(ShoppingCart shoppingCart);
@Select("select *from shopping_cart where user_id=#{currentId}")
    List<ShoppingCart> getcarts(Long currentId);
@Delete("delete from shopping_cart where user_id=#{currentId}")
    void delete(Long currentId);
@Delete("delete from shopping_cart where id=#{id}")
    void deleteByCartId(Long id);
}
